#!/usr/bin/ruby
# -*- ruby -*-
#
# http://www.reddit.com/r/dailyprogrammer/comments/15wm48/132013_challenge_115_intermediate_sumpairings/

require 'set'

ignored = STDIN.readline
ints    = STDIN.readline.strip.split(" ").map { |i| i.to_i }
sum     = STDIN.readline.strip.to_i

targets = ints.inject({}) do |r, i|
    r.merge((sum - i) => i)
end

r = Set.new
ints.each do |i|
    if targets[i]
        r << [i, targets[i]].sort
    end
end

pp r
